<?xml version="1.0" encoding="utf-8" ?>
<sqlMap namespace="RProjectMember" xmlns="http://ibatis.apache.org/mapping" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<alias>
    <typeAlias alias="RProjectMember" type="EIA.PM.Model.RProjectMember, EIA.PM.Model" />
</alias>

<resultMaps>
<resultMap id="select-rprojectmember-result" class="RProjectMember">
<constructor>
    <argument argumentName="prj_id" column="prj_id"/>
    <argument argumentName="stf_id" column="stf_id"/>
    <argument argumentName="stf_name" column="stf_name"/>
    <argument argumentName="work_rate" column="work_rate"/>
    <argument argumentName="cut_rate" column="cut_rate"/>
</constructor>
<!--
    <result property="PrjId" column="prj_id"/>
    <result property="StfId" column="stf_id"/>
    <result property="StfName" column="stf_name"/>
    <result property="WorkRate" column="work_rate"/>
    <result property="CutRate" column="cut_rate"/>
-->
</resultMap>
</resultMaps>

<statements>
<sql id="sql_RProjectMember_where_pk">
WHERE prj_id=#PrjId# AND stf_id=#StfId#
</sql>

<sql id="sql_RProjectMember_where_cv">
<dynamic prepend="WHERE">
    <isPropertyAvailable property="PrjId" prepend="AND">prj_id=#PrjId#</isPropertyAvailable>
    <isPropertyAvailable property="StfId" prepend="AND">stf_id=#StfId#</isPropertyAvailable>
    <isPropertyAvailable property="StfName" prepend="AND">stf_name LIKE concat('%', #StfName#, '%')</isPropertyAvailable>
    <isPropertyAvailable property="WorkRate" prepend="AND">work_rate=#WorkRate#</isPropertyAvailable>
    <isPropertyAvailable property="CutRate" prepend="AND">cut_rate=#CutRate#</isPropertyAvailable>
</dynamic>
</sql>

<sql id="sql_RProjectMember_set_cols">
<dynamic prepend="SET">
    <isPropertyAvailable property="StfName" prepend=",">stf_name=#StfName#</isPropertyAvailable>
    <isPropertyAvailable property="WorkRate" prepend=",">work_rate=#WorkRate#</isPropertyAvailable>
    <isPropertyAvailable property="CutRate" prepend=",">cut_rate=#CutRate#</isPropertyAvailable>
</dynamic>
</sql>

<select id="SelectRProjectMember" parameterClass="" resultMap="RProjectMember.select-rprojectmember-result">
SELECT *
FROM r_project_member
<include refid="sql_RProjectMember_where_pk"/><!--where-->
</select>

<select id="SelectRProjectMember_CV" parameterClass="System.Collections.IDictionary" resultMap="RProjectMember.select-rprojectmember-result">
SELECT *
FROM r_project_member
<include refid="sql_RProjectMember_where_cv"/><!--where-->
</select>

<insert id="InsertRProjectMember" parameterClass="RProjectMember">
<!--pre selectKey place-->
INSERT INTO r_project_member(
<dynamic prepend=" ">
    <isPropertyAvailable property="PrjId" prepend=",">prj_id</isPropertyAvailable>
    <isPropertyAvailable property="StfId" prepend=",">stf_id</isPropertyAvailable>
    <isPropertyAvailable property="StfName" prepend=",">stf_name</isPropertyAvailable>
    <isPropertyAvailable property="WorkRate" prepend=",">work_rate</isPropertyAvailable>
    <isPropertyAvailable property="CutRate" prepend=",">cut_rate</isPropertyAvailable>
</dynamic>
)VALUES(
<dynamic prepend=" ">
    <isPropertyAvailable property="PrjId" prepend=",">#PrjId#</isPropertyAvailable>
    <isPropertyAvailable property="StfId" prepend=",">#StfId#</isPropertyAvailable>
    <isPropertyAvailable property="StfName" prepend=",">#StfName#</isPropertyAvailable>
    <isPropertyAvailable property="WorkRate" prepend=",">#WorkRate#</isPropertyAvailable>
    <isPropertyAvailable property="CutRate" prepend=",">#CutRate#</isPropertyAvailable>
</dynamic>
)
<!--post selectKey place-->
</insert>

<update id="UpdateRProjectMember" parameterClass="System.Collections.IDictionary">
UPDATE r_project_member
<include refid="sql_RProjectMember_set_cols"/><!--set-->
<include refid="sql_RProjectMember_where_pk"/><!--where-->
</update>

<delete id="DeleteRProjectMember" parameterClass="">
DELETE FROM r_project_member
<include refid="sql_RProjectMember_where_pk"/><!--where-->
</delete>

<statement id="DeleteRProjectMember_CV" parameterClass="RProjectMember">
DELETE FROM r_project_member
<include refid="sql_RProjectMember_where_cv"/><!--where-->
</statement>

<delete id="ClearRProjectMember">
DELETE FROM r_project_member
</delete>
</statements>
</sqlMap>